import request from '@/config/axios'

// 员工季度考核 VO
export interface EmployeeQuarterlyAssessmentVO {
  id: number // 主键ID
  years: number // 年份
  quarter: number // 季度(1-4)
  userId: number // 员工ID
  userName: string // 员工姓名
  baseBonusAmount: number // 考核奖金基准金额
  totalScore: number // 考核总分
  quarterlyBonusAmount: number // 季度奖金金额
  status: number // 状态
  remarks: string // 备注
  createTime: string // 创建时间
}

// 员工季度考核 API
export const EmployeeQuarterlyAssessmentApi = {
  // 查询员工季度考核分页
  getEmployeeQuarterlyAssessmentPage: async (params: any) => {
    return await request.get({ url: `/oa/employee-quarterly-assessment/page`, params })
  },

  // 查询员工季度考核详情
  getEmployeeQuarterlyAssessment: async (id: number) => {
    return await request.get({ url: `/oa/employee-quarterly-assessment/get?id=` + id })
  },

  // 新增员工季度考核
  createEmployeeQuarterlyAssessment: async (data: EmployeeQuarterlyAssessmentVO) => {
    return await request.post({ url: `/oa/employee-quarterly-assessment/create`, data })
  },

  // 修改员工季度考核
  updateEmployeeQuarterlyAssessment: async (data: EmployeeQuarterlyAssessmentVO) => {
    return await request.put({ url: `/oa/employee-quarterly-assessment/update`, data })
  },

  // 删除员工季度考核
  deleteEmployeeQuarterlyAssessment: async (id: number) => {
    return await request.delete({ url: `/oa/employee-quarterly-assessment/delete?id=` + id })
  },

  // 导出员工季度考核 Excel
  exportEmployeeQuarterlyAssessment: async (params) => {
    return await request.download({ url: `/oa/employee-quarterly-assessment/export-excel`, params })
  },

  // 查询所有员工季度考核分页（人事专用）
  getAllEmployeeQuarterlyAssessmentPage: async (params: any) => {
    return await request.get({ url: `/oa/employee-quarterly-assessment/page-all`, params })
  },

  // 查询本人季度考核分页（员工自查）
  getMyEmployeeQuarterlyAssessmentPage: async (params: any) => {
    return await request.get({ url: `/oa/employee-quarterly-assessment/page-my`, params })
  },

  // 导入员工季度考核 Excel
  importEmployeeQuarterlyAssessment: async (data: FormData) => {
    return await request.upload({ url: `/oa/employee-quarterly-assessment/import-excel`, data })
  },

  // 下载员工季度考核 Excel 导入模板
  downloadImportTemplate: async () => {
    return await request.download({ url: `/oa/employee-quarterly-assessment/import-template` })
  },

  // 发布员工季度考核
  publishEmployeeQuarterlyAssessment: async (id: number) => {
    return await request.put({ url: `/oa/employee-quarterly-assessment/publish?id=` + id })
  },

  // 取消发布员工季度考核
  unpublishEmployeeQuarterlyAssessment: async (id: number) => {
    return await request.put({ url: `/oa/employee-quarterly-assessment/unpublish?id=` + id })
  },
}
